package com.tpod.taxi;

import tpod.network.HTTPRequest;
import tpod.network.http.HTTPResponseData;
import kds.business.BusinessObject;
import kds.business.BusinessReponse;

public class BaseBusinessReponse<T extends BusinessObject> extends
		BusinessReponse<T> {

	public static final int SUCCESS_CODE = 1;
	public static final int NO_DATA_CODE = 2;

	public String message= "Unknow Error";
	public int code;

	@Override
	public void processResponse(HTTPResponseData data, HTTPRequest request)
			throws Exception {
		super.processResponse(data, request);
		this.code = this.jsonObj.getInt("code");
		this.message = this.jsonObj.getString("message");
		if(this.code!=SUCCESS_CODE && this.code != NO_DATA_CODE)
			throw new Exception(this.message);
	}

}
